package com.ruoyi.web.controller.kaoyan.vo;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.kaoyan.domain.EducationForum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.Map;
import java.util.Optional;

/**
 * 帖子vo 类
 *
 * @author admin
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ForumVo {
    private Long id;
    private String verFlag;
    private String categoryName;
    private String title;
    private String userName;
    private LocalDateTime createTime;

    public ForumVo(EducationForum forum, Map<Long, String> categoryNameMap, Map<Long, String> userNameMap) {
        this.id = forum.getId();
        this.verFlag = StringUtils.isNull(forum.getVerFlag()) ? "null" : forum.getVerFlag().toString();
        this.title = forum.getTitle();
        this.categoryName = categoryNameMap.get(forum.getCategoryId());
        this.userName = userNameMap.get(forum.getUserId());
        this.createTime = forum.getCreateTime();
    }
}
